//
//  XHRAboutProductViewController.m
//  快医
//
//  Created by 胥鸿儒 on 16/7/6.
//
//

#import "XHRAboutProductViewController.h"
#import <SVProgressHUD.h>
//define this constant if you want to use Masonry without the 'mas_' prefix
#define MAS_SHORTHAND

//define this constant if you want to enable auto-boxing for default syntax
#define MAS_SHORTHAND_GLOBALS

#import "Masonry.h"


@interface XHRAboutProductViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong) NSArray *dataArray;



@end


@implementation XHRAboutProductViewController
-(NSArray *)dataArray{

    if (_dataArray == nil ) {
        
        self.dataArray = @[@"用户协议"];

    }
    return _dataArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    self.tableView.delegate = self;
    
    self.tableView.dataSource =self;
    
//    [self initAllView];
    
    [self setUpUI];

}

//界面布局

//组
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

    return 1;

}

//多少行
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return self.dataArray.count;
}

//内容

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    UITableViewCell *cell = [[UITableViewCell alloc] init];

    cell.textLabel.text = self.dataArray[indexPath.row];
    cell.imageView.image = [UIImage imageNamed: @"product_img_icon_xieyi.png"];
//    cell.accessoryView = [UIImageView imageNamed: @"illness_button_input_blue.png"];
    cell.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"illness_button_input_blue.png"]];

    return cell;
}

-(void)setUpUI{
    
    UIView *allHeadView = [[UIView alloc] initWithFrame:CGRectMake(0,64, 375, 220)];
    
    UIImageView *imageView = [[UIImageView alloc] init];
    
    imageView.image = [UIImage imageNamed:@"product_img_logo_nor.png"];
    
    [allHeadView addSubview:imageView];//******要先添加图片 在设置约束
    
    [imageView makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.offset(30);
        make.left.offset(154);
        make.right.offset(-154);
        make.height.equalTo(88);
        
        
    }];

    UIImageView *QcView = [[UIImageView alloc] init];
    
    QcView.image = [UIImage imageNamed:@"product_text_logo_nor.png"];
    
    [allHeadView addSubview:QcView];//******要先添加图片 在设置约束
    
    [QcView makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.offset(125);
        make.left.offset(154);
        make.right.offset(-154);
        make.height.equalTo(49);
        
        
    }];
    
    
    self.tableView.tableHeaderView = allHeadView;

    UIView *allFoodView = [[UIView alloc] initWithFrame:CGRectMake(0,400, 375, 317)];
    
    
    UILabel *qqNum= [[UILabel alloc] init ];
    
    qqNum.textColor = [UIColor blueColor];
    qqNum.text = @"用户交流群 :   4638375473";
    
    [allFoodView addSubview:qqNum];
    
    [qqNum makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.offset(150);
        make.left.offset(80);
        make.right.offset(-80);
        make.height.equalTo(30);
        
        
    }];
    
    
    UILabel *versionNum = [[UILabel alloc] initWithFrame:CGRectMake(120, 220, 175, 50)];
    
    versionNum.text = @"version :   1.4.0";
    versionNum.textColor = [UIColor blueColor];
    
    [allFoodView addSubview:versionNum];
    
    [versionNum makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(qqNum.bottom).offset(10);
        make.left.offset(108);
        make.right.offset(-100);
        make.height.equalTo(30);
        
        
    }];
 
    self.tableView.tableFooterView = allFoodView;


}





-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    //调用三方框架
    [SVProgressHUD showSuccessWithStatus:@"用户协议"];

    //延时执行任务
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
//    [SVProgressHUD setFadeOutAnimationDuration:0.5];
        
        //让它消失
           [SVProgressHUD dismissWithDelay:1];
        

        
    });
    
    

}

/*



/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
